// KafkaListenerAdapter.java
package com.mysteel.cyx.ddd.infrastructure.adater;

import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.springframework.kafka.annotation.KafkaListener;

public class KafkaListenerAdapter {

    @KafkaListener(topics = "${kafka.topic1}")
    public void listenToTopic1(ConsumerRecord<String, String> record) {
        // 处理来自消息主题1的消息
        String message = record.value();
        System.out.println("Received message from topic 1: " + message);
        // 触发相应的业务逻辑
        // invokeBusinessLogic(message);
    }

    @KafkaListener(topics = "${kafka.topic2}")
    public void listenToTopic2(ConsumerRecord<String, String> record) {
        // 处理来自消息主题2的消息
        String message = record.value();
        System.out.println("Received message from topic 2: " + message);
        // 触发相应的业务逻辑
        // invokeBusinessLogic(message);
    }

    // 可以添加更多的监听方法，以处理其他消息主题
}
